﻿#ifndef ZROUNDFRAME_H
#define ZROUNDFRAME_H

/*******************************************************************************
** 圆角窗口类
** 只实现圆角窗口。
** css实现的圆角会被覆盖.只能使用mask实现.
**
**
*******************************************************************************/

#include <QWidget>
#include <QPainterPath>
#include <QPen>

class ZRoundWidget : public QWidget
{
    Q_OBJECT

public:
    explicit ZRoundWidget(QWidget *parent = Q_NULLPTR);
    ~ZRoundWidget();

    void setRound(qreal x_radius, qreal y_radius);
    void setBorder(int width, const QColor &color, Qt::PenStyle);

protected:
    void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
    void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;

private:
    QSize m_size;
    qreal m_xRadius;
    qreal m_yRadius;
    QPen  m_border_pen;
};

#endif // ROUNDFRAME_H
